// =============================================================
// CServiceProxy class
// ---------------------------------------
// Author : Woo-Hyun Kim
// Email : woorung@icu.ac.kr or woorung@nhncorp.com
// Date : Aug. 30, 2007
// =============================================================
#ifndef CServiceProxyH
#define CServiceProxyH
//-----------------------------------------------------------------
#include <iostream>
#include <map>

#include "soap/baseCFactoryProxy.h"

using namespace std;
using namespace base;
//--------------------------------------------------------------------------
class CServiceProxy
{
private:
        static long id;
        std::string name;

	string url;
	CFactoryProxy *service_proxy;

protected:
	virtual void init();
	virtual void fin();

public:
        CServiceProxy();
        CServiceProxy(char *name);
        virtual ~CServiceProxy();

	struct soap *soap();

        void setName(char *name);
        char *getName();

	// garbage collection
	int gc();

	//int lookup(char *name);
	int connect(char *host, int port);

	int initialize(cube__CService *serviceid, int &res);
	int invoke(cube__CService *serviceid, cube__CObject *in, struct cube__invokeResponse &res);
	int finalize(cube__CService *serviceid, int &res);

	// keyval-based simple invocation
	int invoke(char *servicename, map<string,string> &in, map<string,string> &out);
};
//--------------------------------------------------------------------------
#endif
